home *** CD-ROM | disk | FTP | other *** search
-
- #include <jre_demo_HelloWorld.h>
- #include <jni_md.h>
-
- JNIEXPORT void JNICALL Java_jre_demo_HelloWorld_nativeMethod
- (JNIEnv *env, jclass clazz, jstring str) {
-
- const char *cstr;
-
- if (str == NULL) {
- /* raise exception */
- jclass nullPtr = (*env)->FindClass(env, "java/lang/NullPointerException");
- (*env)->ThrowNew(env, nullPtr, "null string");
- return;
- }
-
- cstr = (*env)->GetStringUTFChars(env, str, (jboolean *)NULL);
-
- printf("Window Title is '%s'\n", cstr);
- }
-